<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=utf-8" />
    <title>
      6.48.&nbsp;Procps-ng-3.3.12
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  </head>
  <body class="lfs" id="lfs-8.0">
    <div class="navheader">
      <h4>
        Linux From Scratch - Version 8.0
      </h4>
      <h3>
        第六章 安装基本系统软件
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="gettext.html" title=
          "Gettext-0.19.8.1">上一页</a>
          <p>
            Gettext-0.19.8.1
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="e2fsprogs.html" title=
          "E2fsprogs-1.43.4">下一页</a>
          <p>
            E2fsprogs-1.43.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="chapter06.html" title=
          "第六章 安装基本系统软件">返回</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Linux From Scratch - Version 8.0 ">首页</a>
        </li>
      </ul>
    </div>
    <div class="wrap" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="ch-system-procps" name="ch-system-procps"></a>6.48.
        Procps-ng-3.3.12
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <p>
          Procps-ng 软件包包含了用于检测进程的程序。
        </p>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">预计构建时间:</strong>
              <span class="segbody">0.1 SBU</span>
            </div>
            <div class="seg">
              <strong class="segtitle">需要磁盘空间:</strong>
              <span class="segbody">14 MB</span>
            </div>
          </div>
        </div>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          6.48.1. Procps 安装过程-ng
        </h2>
        <p>
          准备编译 procps-ng:
        </p>
        <pre class="userinput">
<kbd class="command">./configure --prefix=/usr                            \
            --exec-prefix=                           \
            --libdir=/usr/lib                        \
            --docdir=/usr/share/doc/procps-ng-3.3.12 \
            --disable-static                         \
            --disable-kill</kbd>
</pre>
        <div class="variablelist">
          <p class="title">
            <strong>配置选项的含义:</strong>
          </p>
          <dl class="variablelist">
            <dt>
              <span class="term"><em class=
              "parameter"><code>--disable-kill</code></em></span>
            </dt>
            <dd>
              <p>
              　这个选项禁止了编译会被 Util-linux 软件包安装的 <span class=
                "command"><strong>kill</strong></span> 命令。
              </p>
            </dd>
          </dl>
        </div>
        <p>
          编译软件包:
        </p>
        <pre class="userinput">
<kbd class="command">make</kbd>
</pre>
        <p>
        　测试套件需要为 LFS 做一些定制的修改。
        　删除当脚本没有使用一个 tty 设备会失败的测试。　
          要运行测试套件，执行下面的命令：
        </p>
        <pre class="userinput">
<kbd class=
"command">sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp
make check</kbd>
</pre>
        <p>
        　一个 ps 的测试可能会失败，不过如果在第六章结束的时候测试会重新运行的话就忽略它吧。
        </p>
        <p>
          安装软件包:
        </p>
        <pre class="userinput">
<kbd class="command">make install</kbd>
</pre>
        <p>
        　最后，将必要的库移动到一个即使 <code class="filename">/usr</code> 没有挂载也可以发现的地方。
        </p>
        <pre class="userinput">
<kbd class="command">mv -v /usr/lib/libprocps.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so</kbd>
</pre>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          <a id="contents-procps" name="contents-procps"></a>6.48.2. Contents
          of Procps-ng
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">安装的程序:</strong>
              <span class="segbody">free, pgrep, pidof, pkill, pmap, ps,
              pwdx, slabtop, sysctl, tload, top, uptime, vmstat, w, and
              watch</span>
            </div>
            <div class="seg">
              <strong class="segtitle">安装的库:</strong>
              <span class="segbody">libprocps.so</span>
            </div>
            <div class="seg">
              <strong class="segtitle">安装的目录:</strong>
              <span class="segbody">/usr/include/proc and
              /usr/share/doc/procps-ng-3.3.12</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            简要介绍
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="free" name="free"></a><span class=
                    "term"><span class=
                    "command"><strong>free</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　报告系统可用和已用内存（包括物理内存与交换分区）的数量
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="pgrep" name="pgrep"></a><span class=
                    "term"><span class=
                    "command"><strong>pgrep</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　通过进程的名字和其他属性查找进程
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="pidof" name="pidof"></a><span class=
                    "term"><span class=
                    "command"><strong>pidof</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　报告指定程序的 PID
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="pkill" name="pkill"></a><span class=
                    "term"><span class=
                    "command"><strong>pkill</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    　通过进程的名字和其他属性向进程发送信号
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="pmap" name="pmap"></a><span class=
                    "term"><span class=
                    "command"><strong>pmap</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　报告指定进程的内存映像
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="ps" name="ps"></a><span class="term"><span class=
                    "command"><strong>ps</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　列出正在运行的进程
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="pwdx" name="pwdx"></a><span class=
                    "term"><span class=
                    "command"><strong>pwdx</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　报告一个进程的当前工作目录
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="slabtop" name="slabtop"></a><span class=
                    "term"><span class=
                    "command"><strong>slabtop</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　实时显示详细的内核 slap 缓存信息
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="sysctl" name="sysctl"></a><span class=
                    "term"><span class=
                    "command"><strong>sysctl</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　在运行时修改内核参数
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="tload" name="tload"></a><span class=
                    "term"><span class=
                    "command"><strong>tload</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　打印出当前系统平均负载的图
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="top" name="top"></a><span class=
                    "term"><span class="command"><strong>top</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　显示一个使用 CPU 最密集的进程的列表; 它提供了实时显示处理器活动的方法
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="uptime" name="uptime"></a><span class=
                    "term"><span class=
                    "command"><strong>uptime</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　报告系统已经运行了多久，有多少用户已登录，和系统的平均负载
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="vmstat" name="vmstat"></a><span class=
                    "term"><span class=
                    "command"><strong>vmstat</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　报告虚拟内存统计，提供处理器，内存，页面，块输入/输出, traps 和 CPU 活动的信息
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="w" name="w"></a><span class="term"><span class=
                    "command"><strong>w</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　显示哪些用户当前已登录，他们来自哪里以及从何时开始登录
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="watch" name="watch"></a><span class=
                    "term"><span class=
                    "command"><strong>watch</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                  　反复的执行一个指定命令，满屏显示它的输出；这可以让用户观察
                  　程序输出随时间的变化
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="libprocps" name="libprocps"></a><span class=
                    "term"><code class="filename">libprocps</code></span>
                  </p>
                </td>
                <td>
                  <p>
                  　包含了这个软件包大多数程序使用的函数
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="gettext.html" title=
          "Gettext-0.19.8.1">上一页</a>
          <p>
            Gettext-0.19.8.1
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="e2fsprogs.html" title=
          "E2fsprogs-1.43.4">下一页</a>
          <p>
            E2fsprogs-1.43.4
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="chapter06.html" title=
          "第六章 安装基本系统软件">返回</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Linux From Scratch - Version 8.0 ">首页</a>
        </li>
      </ul>
    </div>
  </body>
</html>
